#include <bits/stdc++.h>
// 2025/02/06
// tag: 
// Author: Zhang Muen
using namespace std;

using int64 = int64_t;

int t, n, cnt, v[101], c[101], dp1[1010001], dp2[1010001];

struct item{
    int w, v;
} Coin[100001];

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> t;
    int w = 0;
    for (int i = 1; i <= n; i++)
        cin >> v[i], w = max(w, v[i]);
    for (int i = 1; i <= n; i++)
        cin >> c[i];
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= c[i]; j <<= 1) {
            cnt++;
            Coin[cnt].v = j;
            Coin[cnt].w = j * v[i];
            c[i] -= j;
        }
        if (c[i]) {
            cnt++;
            Coin[cnt].v = c[i];
            Coin[cnt].w = c[i] * v[i];
        }
    }
    memset(dp1, 0x3f, sizeof(dp1));
    dp1[0] = 0;
    for (int i = 1; i <= cnt; i++)
        for (int j = t + w * w; j >= Coin[i].w; j--)
            dp1[j] = min(dp1[j], dp1[j - Coin[i].w] + Coin[i].v);
    memset(dp2, 0x3f, sizeof(dp2));
    dp2[0] = 0;
    for (int i = 1; i <= cnt; i++)
        for (int j = Coin[i].w; j <= t + w * w; j++)
            dp2[j] = min(dp2[j], dp2[j - Coin[i].w] + Coin[i].v);
    int ans = 0x3f3f3f3f;
    for (int i = t; i <= t + w * w; i++)
        ans = min(ans, dp1[i] + dp2[i - t]);
    if (ans != 0x3f3f3f3f)
        cout << ans << endl;
    else
        cout << -1 << endl;
    return 0;
}